Border Padding



Bi-dimensional image padding for spatial filtering and convolution.

Input image and Box Filter function


Without padding, the border of the filtered image will receive 0.

Zero Padding


Pads with a constant value (0 in this case), resulting in a artifact with the same value on the border.

|A B C D E F|

0 0 0 |A B C D E F| 0 0 0

We can notice a black border on the filtered image.

Wrap Padding


Pads with a modular repetition of each axis, resulting in some artifacts from the opposite edges.

|A B C D E F|

D E F |A B C D E F| A B C

We can notice a red artifact on the top of the filtered image which was spread from the bottom part.

Reflect Padding


Pads with the reflection of each axis.

|A B C D E F|

D C B |A B C D E F| E D C

Edge Padding


Pads with the edge pixel of each axis.

|A B C D E F|

A A A |A B C D E F| F F F